package com.itboye.ihomebank.adapter;

import com.itboye.ihomebank.R;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.ArrayList;

public class ListAdapter extends BaseAdapter{

	  Context context;
	  String[] str;
	    public ListAdapter(Context context, String[] str) {
		this.context=context;
		this.str=str;
	}
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return str.length;
	}

	@Override
	public String getItem(int position) {
		// TODO Auto-generated method stub
		return str[position];
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		MyViewHolder myViewHolder;
		if(convertView==null){
			myViewHolder=new MyViewHolder();
			convertView=LayoutInflater.from(context).inflate(R.layout.item_rentlist, null);
			myViewHolder.item= (TextView) convertView.findViewById(R.id.rentItem);
			convertView.setTag(myViewHolder);
		}else {
			myViewHolder= (MyViewHolder) convertView.getTag();
		}
		    myViewHolder.item.setText(str[position]);
		
		return convertView;
	}
	class MyViewHolder  {
		TextView item;

	}
}
